public class Demo5 {
    private static int result = 0;
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            for (int i = 0; i < 500; i++) {
                result += i;
            }
            System.out.println("计算完毕");
        });
        t.start();
        t.join();
        System.out.println("result = " + result);
    }
}











